package com.gimi.cloud.bbp.client.controller.order;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.gimi.cloud.bbp.client.service.order.OrderService;
import com.gimi.cloud.bbp.common.utils.reqhead.Util;
import com.gimi.cloud.bbp.dto.order.OrderDTO;

/**
 * 订单相关服务
 * @author 李林峰
 * @version 1.0
 * @Description
 * @create 2018年1月25日
 */
@RestController
@RequestMapping("/order")
public class OrderController {
	@Autowired OrderService orderService;
	
	/**
	 * 获取用户订单列表
	 * @param orderDTO
	 * @param response
	 */
	@RequestMapping(value = "/userOrderList")
	public void userOrderList(@RequestBody OrderDTO orderDTO,HttpServletResponse response) {
		Util.sendResponse(JSON.toJSONString(orderService.userOrderList(orderDTO)),response);
	}
	
	/**
	 * 修改用户订单状态
	 * @param orderDTO
	 * @param response
	 */
	@RequestMapping(value = "/modifyOrderStatus")
	public void modifyOrderStatus(@RequestBody OrderDTO orderDTO,HttpServletResponse response) {
		Util.sendResponse(JSON.toJSONString(orderService.modifyOrderStatus(orderDTO)),response);
	}
	
	/**
	 * 获取订单详情
	 * @param orderDTO
	 * @param response
	 */
	@RequestMapping(value = "/getOrderDetails")
	public void getOrderDetails(@RequestBody OrderDTO orderDTO,HttpServletResponse response) {
		Util.sendResponse(JSON.toJSONString(orderService.getOrderDetails(orderDTO)),response);
	}
}